import java.util.HashMap;


public class State {
	
	private HashMap<Direction, Float> qvalues = new HashMap<Direction, Float>();
	private Coordinate coordinate;
	
	public State(int x, int y){
		this.coordinate = new Coordinate(x, y);
		for(Direction direction : Direction.values()){
			this.qvalues.put(direction, 0f);
		}
	}
	
	public int getX() {
		return this.coordinate.getX();
	}
	
	public int getY() {
		return this.coordinate.getY();
	}
	
	protected void setQValue(Direction direction, float value){
		this.qvalues.put(direction, value);
	}
	
	protected float getQValue(Direction direction){
		return this.qvalues.get(direction);
	}
	
	protected HashMap<Direction, Float> getQValues(){
		return this.qvalues;
	}
	
	public String toString(){
		String result = "(";
		for(Direction direction : Direction.values()){
			result = result.concat(qvalues.get(direction) + " ");
		}
		result = result.concat(")");
		return result;
	}
	
	public String bestDirection(){
		String result = "(";
		Direction bestDirection = Direction.NORTH;
		for(Direction direction : Direction.values()){
			if(this.getQValue(direction) > this.getQValue(bestDirection)){
				bestDirection = direction;
			}
		}
		result = result.concat(bestDirection+")");
		return result;
	}
}
